

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <g:if test="${tipo == 'Admin'}">
        	   <meta name="layout" content="adminContas" />
        </g:if>
        <g:else>
           		<meta name="layout" content="usuarioContas" />
        </g:else>
        <g:set var="entityName" value="${message(code: 'usuarioComum.label', default: 'UsuarioComum')}" />
        <title>SPL - Administrador - Atualizando dados</title>
    </head>
    <body>
        <div class="body">
            <h1><g:message code="Atualizando dados" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${usuarioComumInstance}">
            <div class="errors">
                <g:renderErrors bean="${usuarioComumInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${usuarioComumInstance?.id}" />
                <g:hiddenField name="version" value="${usuarioComumInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="senha"><g:message code="usuarioComum.senha.label" default="Senha" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: usuarioComumInstance, field: 'passwd', 'errors')}">
                                    <g:passwordField name="senha" value="${usuarioComumInstance?.passwd}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="email"><g:message code="usuarioComum.email.label" default="Email" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: usuarioComumInstance, field: 'email', 'errors')}">
                                    <g:textField name="email" maxlength="50" value="${usuarioComumInstance?.email}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="telefone"><g:message code="usuarioComum.telefone.label" default="Telefone" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: usuarioComumInstance, field: 'telefone', 'errors')}">
                                    <g:textField size="2" name="ddd" maxlength="2" value="${telefoneInstance?.ddd}" />
                                    <g:textField size="4" name="telefoneParte1" maxlength="4" value="${telefoneInstance?.telefoneParte1}" />
                                    <g:textField size="4" name="telefoneParte2" maxlength="4" value="${telefoneInstance?.telefoneParte2}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="nome"><g:message code="usuarioComum.nome.label" default="Nome" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: usuarioComumInstance, field: 'userRealName', 'errors')}">
                                    <g:textField name="nome" maxlength="50" value="${usuarioComumInstance?.userRealName}" />
                                </td>
                            </tr>
                        	
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="projeto"><g:message code="usuarioComum.projeto.label" default="Projeto" /></label>
                                </td>
                                <td valign="top" class="name">
                                    <g:select id="projeto" name="projeto" default="Projeto" noSelection="${['Novo Projeto':message(code:'Novo Projeto')]}" from="${tiposProjeto}" value="${usuarioComumInstance?.projeto}"/>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="projeto"><g:message code="usuarioComum.projeto.label" default="Novo Projeto" /></label>
                                </td>
                             	<td valign="top" class="value ${hasErrors(bean: usuarioComumInstance, field: 'projeto', 'errors')}">
                             		<g:textField name="projeto" value="${usuarioComumInstance?.projeto}"/>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="tipo"><g:message code="usuarioComum.tipo.label" default="Tipo" /></label>
                                </td>
                                <td valign="top" class="name">
                                    <g:select id="tipo" name="tipo" default="Tipo" noSelection="${['Novo Tipo':message(code:'Novo Tipo')]}" from="${tiposUsuario}" value="${usuarioComumInstance?.tipo}"/>
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="tipo"><g:message code="usuarioComum.tipo.label" default="Novo Tipo" /></label>
                                </td>
                             	<td valign="top" class="value ${hasErrors(bean: usuarioComumInstance, field: 'tipo', 'errors')}">
                                    <g:textField name="tipo" value="${usuarioComumInstance?.tipo}"/>
                                </td>
                            </tr>                            
                            
                            <% def data = new Date() %>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="anoIngresso"><g:message code="usuarioComum.anoIngresso.label" default="Ano de Ingressao" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: usuarioComumInstance, field: 'anoIngresso', 'errors')}">
                                    <g:select id="anoSelection" name="anoIngresso" default="" noSelection="${['Ano':message(code:' ')]}" from="${data.year+1900..1800}" value="${fieldValue(bean: usuarioComumInstance, field: 'anoIngresso')}"/>
                                   
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value='Atualizar' onclick="return confirm('Tem certeza que deseja atualizar os dados?');" /></span>
                     <g:if test="${tipo == 'Admin'}">
                    	<span class="button"><g:actionSubmit class="delete" action="delete" value='Remover' onclick="return confirm('Tem certeza que deseja remover este usuario?');" /></span>
                    </g:if>
                </div>
            </g:form>
        </div>
    </body>
</html>
